<template>
	<view>
		<view class="d-flex j-sb p-3 border main-text-color font">
			<view>
				序号
			</view>
			<view class="ml-2">
				姓名
			</view>
			<view class="mr-5">
				人员编号
			</view>
		</view>
		<view style="height: 1180rpx;">
			<view class="d-flex j-sb p-3 main-text-color_2 font flex-1 border-bottom pb-4"
				v-for="(item,index) in IPQC_list" :key="index" @tap="toditel(item.worknumber)">
				<block>
					<view style="width: 120rpx;margin-left: 10rpx;">
						{{item.id}}
					</view>
					<view>
						{{item.iName}}
					</view>
					<view style="width:220rpx; hidden;white-space: nowrap;text-overflow:ellipsis; text-align: center;">
						{{item.worknumber}}
					</view>
				</block>
			</view>
		</view>
		<view class="build_bttom_page d-flex j-sb p-3 a-center" style="position: relative;">
			<view class="d-flex a-center">
				<image src="../../static/image/left.png" mode="widthFix" style="width: 20rpx;height: 20rpx;"></image>
				<view class="pl-2 font" @tap="pageing(1)">
					上一页
				</view>
			</view>
			<view style="padding-left: 165rpx;padding-right: 150rpx;">
				<view class="main-bg-color d-flex j-center a-center"
					style="width: 120rpx;height: 48rpx;border-radius: 50rpx;color: #fff;">
					第{{pageNum}}页
				</view>
			</view>
			<view class="d-flex a-center" @tap="pageing(2)">
				<view class="pr-2 font">
					下一页
				</view>
				<image src="../../static/image/right.png" mode="widthFix" style="width: 20rpx;height: 20rpx;"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//维保单位id
				deptId: '',
				//建筑列表
				IPQC_list: [],
				//第一页
				pageNum: 1
			};
		},
		onLoad(e) {
			this.deptId = e.deptId
			console.log(this.deptId, '维保单位id');
			this.$https.get('system/ipqc/list3', {
				deptId: this.deptId,
				pageSize: 10,
				pageNum: this.pageNum
			}).then(res => {
				this.IPQC_list = res.rows
				console.log(this.IPQC_list, 'IPQC_list');
			})
		},
		methods: {
			//分页
			pageing(e) {
				console.log(e);
				switch (e) {
					case 1:
						if (this.pageNum == 1) {
							this.pageNum == 1
							uni.showToast({
								title: '已经是第一页了！',
								icon: 'none'
							})
						} else {
							this.pageNum--
							this.$https.get('system/ipqc/list3', {
								deptId: this.deptId,
								pageSize: 10,
								pageNum: this.pageNum
							}).then(res => {
								this.IPQC_list = res.rows
							})
						}
						break;
					case 2:
						this.$https.get('system/ipqc/list3', {
							deptId: this.deptId,
							pageSize: 10,
							pageNum: this.pageNum + 1
						}).then(res => {
							console.log(res, 'res');
							if (res.rows.length == 0) {
								uni.showToast({
									title: '无更多数据',
									icon: 'none'
								})
							} else {
								this.pageNum++
								this.IPQC_list = res.rows
							}

						})
						break;
				}
			},
			//建筑详情
			toditel(e) {
				console.log(e, '巡检员编号');
				uni.navigateTo({
					url: "./IPQC_detail?worknumber=" + e
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
